import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/commodity/pickerCategories/picker_commodity_provider.dart';
import 'package:boss/ui/widget/label_button.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class CategoriesMessage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 80.w,
      padding: EdgeInsets.only(left: 20.w),
      alignment: Alignment.centerLeft,
      child: Consumer<PickerCommodityProvider>(
        builder: (context, commodityProvider, child) {
          return Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              RichText(
                text: TextSpan(
                  text: '【${commodityProvider.currentMenuCategory?.menuName ?? '--'}】',
                  style: TextStyleConstant().normal_1_28,
                  children: [
                    TextSpan(text: '${commodityProvider.currentCommoditys.length}个', style: TextStyleConstant().normal_4_24),
                  ],
                ),
              ),
              LabelButton(
                title: commodityProvider.isSelectedAllCategoryCommodity ? '取消' : '全选',
                textStyle: TextStyleConstant().blue_24,
                padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 4),
                onTap: commodityProvider.selectedAllCategoryCommodity,
              ),
            ],
          );
        },
      ),
    );
  }
}
